package com.zp.self.BIO;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.Socket;

public class TimeClient {


    public static void main(String[] args) throws IOException, InterruptedException {

        Socket socket = new Socket("127.0.0.1", 8080);
        System.out.println("Connected with server " + socket.getInetAddress() + ":" + socket.getPort());


        DataOutputStream out = null;
        InputStream in = null;
        try {
            in = socket.getInputStream();
            out = new DataOutputStream(socket.getOutputStream());
            byte[] b = "QUERY TIME ORDER".getBytes();
            out.write(b);
            byte[] b2 = new byte[4096];
            in.read(b2);
            System.out.println("接收"+new String(b2));
        } finally {
            in.close();
            out.close();
        }
    }
}
